pull: Ensure temporary data that appears corrupted is deleted
authorColin Walters <walters@verbum.org>
Sat, 8 Mar 2014 00:30:01 +0000 (19:30 -0500)
committerColin Walters <walters@verbum.org>
Sat, 8 Mar 2014 00:36:55 +0000 (19:36 -0500)
commitc2123bfc71edc905ddd76dac8ee0ed00353179d3
treedca82bedec2ef5b2c5717c7bc619ee6c073e8d35
parent19d36c540a4e003589e8209ebe87c74721b15b45
pull: Ensure temporary data that appears corrupted is deleted

If a MITM attacker (or just network corruption) causes a temporary
downloaded object in tmp/ to be corrupted, we'll end up
continually trying to commit it, and fail.

Fix this unlinking the temp file immediately after opening it.  This
will ensure that if we exit due to an error (or crash), the kernel
will clean up the space for us.

https://bugzilla.gnome.org/show_bug.cgi?id=725924
src/libostree/ostree-repo-pull.c